* Replication code for “The Unsettled Effect of Physical Height on Political ///
* Preferences” by Barry C. Burden, Pamela Herd, and Donald P. Moynihan, ///
* published in Political Science Research and Methods

* Begin by acquiring the necessary variables from the the Wisconsin ///
* Longitudinal Study (WLS) in "long" form ///
* (see https://researchers.wls.wisc.edu/data/survey-data/)


* 1. LOAD DATASET

set maxvar 20000
use "BHM PSRM WLS.dta"


* 2. RECODE VARIABLES

* height

recode z_hx452re -30/-2=.
gen measured_height = z_hx452re

* weight

recode z_hx455re -30/-2=.
gen measured_weight = z_hx455re 

* health

recode z_gx202are -2=.
gen hui05 = z_gx202are

* partisanship

recode z_iz102rer -3/-1=. 6=. 1=5 2=1 3=4 4=2 5=3
recode z_jz102rer -29/-1=. 5=3 1=5 2=1 3=4 4=2 6/11=.
gen party05 = z_iz102rer
gen party11 = z_jz102rer

* ideology

recode z_iz103rer -3/-1=. 
recode z_jz103rer -29/-1=.
gen ideo05 = z_iz103rer
gen ideo11 = z_jz103rer

* education

gen college2005 = z_gb103red
recode college2005 -4/-3=. 0/15=0 16/21=1

* income & wealth

recode z_gp260hec -5=.
recode z_gr100rpc -10000000000/-1=.
gen thi05 = z_gp260hec/1000
gen worth05 = z_gr100rpc/1000

* gender

gen female = z_sexrsp
recode female 2=1 1=0
gen samegender = 1 if female==1 & z_hk029ssd==2
replace samegender = 1 if female==0 & z_hk029ssd==1
replace samegender = 0 if female==1 & z_hk029ssd==1
replace samegender = 0 if female==0 & z_hk029ssd==2

* age

gen age05 = 2005-(1900+z_brdxdy) if z_brdxdy>0
gen age11 = 2011-(1900+z_brdxdy) if z_brdxdy>0

* big 5 personality traits

gen extra05 = z_ih001rec
recode extra05 -2=.
gen agree05 = z_ih009rec
recode agree05 -27/-2=.
gen consc05 = z_ih017rec
recode consc05 -27/-2=.
gen neurot05 = z_ih025rec
recode neurot05 -27/-2=.
gen open05 = z_ih032rec
recode open05 -27/-2=.

* environmental mastery

gen mastery05 = z_in010rec
recode mastery05 -2=.

* birthweight

gen birthweight = z_ie007rec
recode birthweight -2=.


* 3. GENERATE TABLES AND FIGURES IN MAIN BODY OF ARTICLE

* FIGURE 2: Box Plot of Height by Party Identification

label define party05 1 "Democrat" 2 "Ind Democrat" 3 "Independent" ///
   4 "Ind Republican" 5 "Republican"
label values party05 party05
gen height_female = measured_height if female==1
gen height_male = measured_height if female==0
set scheme plotplain
graph box height_female height_male, over(party05) ///
   ytitle("Measured Height (in Inches)") marker(1, msymbol(smcircle)) ///
   marker(2, msymbol(smcircle)) plotregion(lcolor(black)) ///
   legend(pos(5) ring(0) label(1 "Female") label(2 "Male"))
   
* TABLE 1: Measured Height and Party Identification (8 models)  

ologit party05 measured_height age05 i.familypub if samegender==1
bysort female: ologit party05 measured_heigh age05 i.familypub if samegender==1 
bysort female: ologit party05 measured_height thi05 worth05 age05 ///
   i.familypub if samegender==1
ologit party11 measured_height age11 i.familypub if samegender==1
bysort female: ologit party11 measured_height age11 i.familypub if samegender==1

* TABLE 2: Measured Height and Party Identification - Potential Confounders

* health
ologit party05 measured_height hui05 age05 i.familypub if samegender==1
* weight
ologit party05 measured_height measured_weight age05 i.familypub if samegender==1
* environmental mastery
ologit party05 measured_height mastery05 age05 i.familypub if samegender==1 
* birthweight
ologit party05 measured_height birthweight age05 i.familypub if samegender==1
* education
ologit party05 measured_height college2005 age05 i.familypub if samegender==1
* personality 
ologit party05 measured_height extra05 agree05 consc05 neurot05 ///
  open05 age05 i.familypub if samegender==1 
  
  
* 4. GENERATE TABLES IN APPENDIX  
  
* TABLE A1. Measured Height and Party Identification without Fixed Effects  

ologit party05 measured_height age05
ologit party05 measured_height age05 if samegender==1
ologit party05 measured_height age05 female
ologit party05 measured_height age05 female if samegender==1
bysort female: ologit party05 measured_height age05
bysort female: ologit party05 measured_height age05 if samegender==1
ologit party11 measured_height age11
ologit party11 measured_height age11 female

* TABLE A2. Replication of Table 2 without Fixed Effects but with Gender

* health
ologit party05 measured_height hui05 age05 female if samegender==1
* weight
ologit party05 measured_height measured_weight age05 female if samegender==1
* environmental mastery
ologit party05 measured_height mastery05 age05 female if samegender==1 
* birthweight
ologit party05 measured_height birthweight age05 female if samegender==1
* education
ologit party05 measured_height college2005 age05 female if samegender==1
* personality 
ologit party05 measured_height extra05 agree05 consc05 neurot05 ///
  open05 age05 female if samegender==1 
  
* TABLE A3. Measured Height and Ideology without Fixed Effects  
  
ologit ideo05 measured_height age05
ologit ideo05 measured_height age05 if samegender==1
ologit ideo05 measured_height age05 female
ologit ideo05 measured_height age05 female if samegender==1
bysort female: ologit ideo05 measured_height age05
ologit ideo11 measured_height age11
ologit ideo11 measured_height age11 female

* TABLE A4. “First Stage” Relationships between Height and Income/Wealth

regress thi05 measured_height age05
regress worth05 measured_height age05
regress thi05 measured_height age05 female
regress worth05 measured_height age05 female
bysort female: regress thi05 measured_height age05
bysort female: regress worth05 measured_height age05

* TABLE A5: Descriptive Statistics in Full WLS Sample

summ party05 party11 ideo05 ideo11 measured_height age05 age11 female ///
   hui05 birthweight measured_weight mastery05 college2005 extra05 agree05 ///
   consc05 neurot05 open05 thi05 worth05





